package seta.minecredit;

import java.util.Calendar;

public class CreditLoop extends Thread  {

	Files Filer;
	
	public CreditLoop(Files filer) {
		Filer = filer;
	}

	public void run(){
		while(MineCredit.doloop == true){
			try {
				Thread.sleep(55000);  
			} catch (InterruptedException ie){
				
			}
			Calendar cal = Calendar.getInstance();
			cal.setTime(new java.util.Date());
			String time = cal.get(Calendar.HOUR_OF_DAY)+":"+cal.get(Calendar.MINUTE);
			if(time.equals(Filer.getConfKey("interesttime"))){
				if(Filer.getLastInterest() != cal.get(Calendar.DAY_OF_MONTH)){
					Filer.setLastInterest(cal.get(Calendar.DAY_OF_MONTH));
					Filer.calcInterest();
				}
			}
		}
	}
	
}
